From 2258445464a0ba0f700ee6e3b886d98b0253992a Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 13 Jun 2007 11:27:47 +0100 Subject: [PATCH] xenapi: Implement XenAPI method VBD.set_mode in python. Signed-off-by: Jim Fehlig --- tools/python/xen/xend/XendAPI.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 45f9e2bdb4..05c6e0cf2d 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -1887,6 +1887,17 @@ class XendAPI(object): xd.managed_config_save(vm) return xen_api_success_void() + def VBD_set_mode(self, session, vbd_ref, mode): + if mode == 'RW': + mode = 'w' + else: + mode = 'r' + xd = XendDomain.instance() + vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref) + vm.set_dev_property('vbd', vbd_ref, 'mode', mode) + xd.managed_config_save(vm) + return xen_api_success_void() + def VBD_get_all(self, session): xendom = XendDomain.instance() vbds = [d.get_vbds() for d in XendDomain.instance().list('all')] -- 2.30.2